import { DataSource } from "maishu-wuzhui-helper";
import { ReceivementAccount } from "entities";
import { AccountService } from "./account-service";
import { errorHandle } from "maishu-chitu-admin/static";


let account = new AccountService(err => errorHandle(err));
export let receivementAccount = new DataSource<ReceivementAccount>({
    primaryKeys: ['Id'],
    select: async () => {
        let r = await account.receivementAccountList();
        return { dataItems: r, totalRowCount: r.length };
    },
    insert: (item) => account.saveReceivementAccount(item),
    update: (item) => account.saveReceivementAccount(item)
});

export let dataSources = {
    receivementAccount
}